package ru.urfc.portal.rest;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import ru.urfc.portal.managers.CatalogManager;
import ru.urfc.portal.model.Branch;
import ru.urfc.portal.model.admins.UserRole;
import ru.urfc.portal.model.admins.UserState;
import ru.urfc.portal.model.catalogs.DeviceState;
import ru.urfc.portal.model.documents.DocumentState;
import ru.urfc.portal.model.documents.DocumentType;
import ru.urfc.portal.ui.client.Constants;

@Stateless
@Produces({MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
@Path(Constants.CATALOGS)
public class CatalogsService extends BaseService {

	@EJB CatalogManager catalogManager;
	
	@GET
	@Path(BRANCHES)
	public List<Branch> getBranches() {
		return catalogManager.getBranches();
	}
	
	@GET
	@Path(USER_ROLES)
	public List<UserRole> getUserRoles() {
		return catalogManager.getUserRoles();
	}
	
	@GET
	@Path(USER_STATES)
	public List<UserState> getUserStates() {
		return catalogManager.getUserStates();
	}	

	@GET
	@Path(DEVICES_STATES)
	public List<DeviceState> getDeviceStates(@PathParam("clientId") Long clientId) {
		return catalogManager.getDeviceStates();
	}
	
	@GET
	@Path(DOCUMENT_TYPES)
	public List<DocumentType> getDocumentTypes() {
		return catalogManager.getDocumentTypes();
	}
	
	@GET
	@Path(DOCUMENT_STATES)
	public List<DocumentState> getDocumentStates() {
		return catalogManager.getDocumentStates();
	}

}
